<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>定义捕获器</title>
</head>
<body>
  <script>
    const target = {
      foo: 'bar'
    };

    const proxy = new Proxy(target, {
      get() {
        return 'handler override';
      }
    });

    console.log(target.foo);  // bar
    console.log(proxy.foo);  // handler override

    console.log(target['foo']);  // bar
    console.log(proxy['foo']);  // handler override

    console.log(Object.create(target)['foo']);  // bar
    console.log(Object.create(proxy)['foo']);  // handler override
  </script>
</body>
</html>